import clock.*;

import java.lang.Thread;
import java.lang.InterruptedException;
import java.util.Scanner;

public class Program {

    public static void main(String[] args) {
        Clock clock = new Clock();
        Thread clocksred = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    System.out.println(clock.currentTime());
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        clocksred.start();
        Scanner scanner = new Scanner(System.in);
        Thread inputsred = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    String input = scanner.nextLine();
                    switch (!input.equals("") ? input.charAt(0) : '\n') {
                        case 'j':
                            clock.button1();
                            break;
                        case 'k':
                            clock.button2();
                            break;
                    }
                }
            }
        });
        inputsred.start();
    }

}